package com.an.demo.controller;

import cn.dev33.satoken.annotation.SaIgnore;
import com.an.common.core.domain.R;
import com.an.common.core.domain.bo.SendCodeBo;
import com.an.common.constant.MqConstants;
import com.an.producer.MqProducer;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Mq演示控制器
 *
 * @author: Ann
 * @createDate: 2024/04/09
 */
@RequiredArgsConstructor
@RestController
@RequestMapping("/demo/mq")
@SaIgnore
public class MqDemoController {

    private final MqProducer mqProducer;

    @GetMapping("/sendMessage")
    public R<String> testSentMqMessage(String msg) {
        SendCodeBo sendCodeBo = new SendCodeBo();
        sendCodeBo.setEmail("1983933789@qq.com");
        sendCodeBo.setType("0");
        mqProducer.sendMessage(MqConstants.MAIL_EXCHANGE, MqConstants.MAIL_SEND_KEY, sendCodeBo);
        return R.ok();
    }

}
